package com.pptv.mtbu.ottflow.action.authority;

import com.opensymphony.xwork2.*;

import com.opensymphony.xwork2.interceptor.*;

import com.pptv.mtbu.ottflow.action.WebConstant;


public class AdminAuthorityInterceptor
	extends AbstractInterceptor
{
	public String intercept(ActionInvocation invocation)
		throws Exception
	{

		ActionContext ctx = ActionContext.getContext();

		String role = (String)ctx.getSession()
			.get(WebConstant.ROLE);
	
		if (role != null
			&& (role.equals(WebConstant.ADMIN_ROLE)
			|| role.equals(WebConstant.SUPERADMIN_ROLE)))
		{
			return invocation.invoke();
		}
		else
		{
			return Action.LOGIN;
		}
	}
}